Repository navigation
Clarify intcomma errors for negative precision - #467
Open
ShahadatTest wants to merge 1 commit into
Open
ShahadatTest wants to merge 1 commit into
ShahadatTest wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #466.
Passing a negative
ndigitstointcomma()currently exposes Python'sValueError: Format specifier missing precision. RaiseValueError: ndigits must be non-negativeinstead, and document the supported precision and exception.The validation stays after the existing value conversion, preserving how non-numeric and non-finite inputs are handled. Add six regression cases covering
-1and-10for integer, float, and numeric-string values. All six fail against the original source because the error message is different.Validation on Windows, CPython 3.14.6:
pytest --benchmark-disable --doctest-modules --color=no -q: 860 passed, 2 skipped. The skipped cases update translations and require GNU gettext tools unavailable on this machine. Existing translation catalogs were compiled locally withpolibfor the remaining localization tests; benchmark timing was disabled.pytest tests/test_number.py -q --color=no: 247 passed.prek run --files src/humanize/number.py tests/test_number.py: passed.mypy .: passed, 14 source files.mkdocs build --strict: passed.AI disclosure: the implementation, tests, and this description were prepared with OpenAI Codex.